﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quizzer.Helpers;

namespace Quizzer.Model
{
    public class SampleData
    {
        public SampleData()
        {
            Account acc1 = new Account() { Username = "mark", Password = OtherHelpers.GetMD5("mark") };
            Account.Items.Add(acc1.Id, acc1);
       
            Course course1 = new Course() { Title = "Course 1", CreationDate = DateTime.Now, Description = "description" };
            Course course2 = new Course() { Title = "Course 2", Description = "description" };
            Course course3 = new Course() { Title = "Course 3", Description = "description" };
            Course course4 = new Course() { Title = "Course 4" };
            Course.Items.Add(course1.Id, course1);
            Course.Items.Add(course2.Id, course2);
            Course.Items.Add(course3.Id, course3);
            Course.Items.Add(course4.Id, course4);

            CourseAccount ca1 = new CourseAccount() { AccountID = acc1.Id, CourseID = course1.Id, IsFavorite = true };
            CourseAccount ca2 = new CourseAccount() { AccountID = acc1.Id, CourseID = course2.Id, IsDone = true };
            CourseAccount ca3 = new CourseAccount() { AccountID = acc1.Id, CourseID = course3.Id };
            CourseAccount ca4 = new CourseAccount() { AccountID = acc1.Id, CourseID = course4.Id };
            CourseAccount.Items.Add(ca1.Id, ca1);
            CourseAccount.Items.Add(ca2.Id, ca2);
            CourseAccount.Items.Add(ca3.Id, ca3);
            CourseAccount.Items.Add(ca4.Id, ca4);

            Test test1 = new Test() { Title = "Test 1", Attempts = 1, CourseID = course1.Id, NumberOfQuestions = 3, Difficulty = 1 };
            Test test2 = new Test() { Title = "Test 2", Attempts = 2, CourseID = course2.Id, NumberOfQuestions = 20, Difficulty = 1 };
            Test test3 = new Test() { Title = "Test 3", Attempts = 3, CourseID = course2.Id, NumberOfQuestions = 10, Difficulty = 2 };
            Test test4 = new Test() { Title = "Test 4", Attempts = 1, CourseID = course3.Id, Difficulty = 3 };
            Test test5 = new Test() { Title = "Test 5", Attempts = 2, CourseID = course4.Id, Description = "Test5ololo" };
            Test test6 = new Test() { Title = "Test 6", Attempts = 3, CourseID = course4.Id };
            Test.Items.Add(test1.Id, test1);
            Test.Items.Add(test2.Id, test2);
            Test.Items.Add(test3.Id, test3);
            Test.Items.Add(test4.Id, test4);
            Test.Items.Add(test5.Id, test5);
            Test.Items.Add(test6.Id, test6);

            Question q1 = new Question() { Text = "Question 1", Description = "Question 1 Descrition", TestID = test1.Id, IsCheckBoxes = true };
            Question q2 = new Question() { Text = "Question 2", Description = "Question 2 Descrition", TestID = test1.Id, IsCustomAnswer = true };
            Question q3 = new Question() { Text = "Question 3", Description = "Question 3 Descrition", TestID = test1.Id};
            Question q4 = new Question() { Text = "Question 4", Description = "Question 4 Descrition", TestID = test3.Id, IsCheckBoxes = false };
            Question q5 = new Question() { Text = "Question 5", Description = "Question 5 Descrition", TestID = test4.Id, IsCustomAnswer = true };
            Question q6 = new Question() { Text = "Question 6", Description = "Question 6 Descrition", TestID = test5.Id };
            Question q7 = new Question() { Text = "Question 7", Description = "Question 7 Descrition", TestID = test6.Id, IsCheckBoxes = true };
            Question q8 = new Question() { Text = "Question 8", Description = "Question 8 Descrition", TestID = test2.Id };
            Question q9 = new Question() { Text = "Question 9", Description = "Question 9 Descrition", TestID = test3.Id };
            Question.Items.Add(q1.Id, q1);
            Question.Items.Add(q2.Id, q2);
            Question.Items.Add(q3.Id, q3);
            Question.Items.Add(q4.Id, q4);
            Question.Items.Add(q5.Id, q5);
            Question.Items.Add(q6.Id, q6);
            Question.Items.Add(q7.Id, q7);
            Question.Items.Add(q8.Id, q8);
            Question.Items.Add(q9.Id, q9);

            Answer a1 = new Answer() { QuestionID = q1.Id, Text = "Answer1", Weight=0 };
            Answer a2 = new Answer() { QuestionID = q1.Id, Text = "Answer2", Weight=1 };
            Answer a3 = new Answer() { QuestionID = q1.Id, Text = "Answer3", Weight=0 };
            Answer a4 = new Answer() { QuestionID = q1.Id, Text = "Answer4", Weight=1 };
            Answer a5 = new Answer() { QuestionID = q3.Id, Text = "Answer1", Weight=1 };
            Answer a6 = new Answer() { QuestionID = q3.Id, Text = "Answer2", Weight=1 };
            Answer a7 = new Answer() { QuestionID = q3.Id, Text = "Answer3", Weight=0 };
            Answer a8 = new Answer() { QuestionID = q3.Id, Text = "Answer4", Weight=1 };
            Answer a9 = new Answer() { QuestionID = q2.Id, Text = "Answer5", Weight=0 };
            Answer.Items.Add(a1.Id, a1);
            Answer.Items.Add(a2.Id, a2);
            Answer.Items.Add(a3.Id, a3);
            Answer.Items.Add(a4.Id, a4);
            Answer.Items.Add(a5.Id, a5);
            Answer.Items.Add(a6.Id, a6);
            Answer.Items.Add(a7.Id, a7);
            Answer.Items.Add(a8.Id, a8);
            Answer.Items.Add(a9.Id, a9);
        }
    }
}
